package exam.ant.S3;

import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc  = new Scanner(System.in);
        String s = sc.nextLine();
        System.out.println(main32(s));
    }

    private static int solution(String s) {
        int res = 0;
        int[] cnt = new int[26];
        for (int i=0; i<s.length(); ++i) {
            Arrays.fill(cnt, 0);
            cnt[s.charAt(i) - 'a'] = 1;
            res++;
            int odd = 1;
            for (int j = 1; i - j >= 0 && i + j < s.length(); ++j) {
                if (cnt[s.charAt(i-j) - 'a'] % 2 == 1)
                    odd--;
                else
                    odd++;
                cnt[s.charAt(i-j) - 'a']++;
                if (cnt[s.charAt(i+j) - 'a'] % 2 == 1)
                    odd--;
                else
                    odd++;
                cnt[s.charAt(i+j) - 'a']++;
                if (odd == 1)
                    res++;
            }
        }
        return res;
    }

    public static long main32(String s) {
        Set<Integer> set = new HashSet<>(30);
        for(int i = 0; i < 30; i++){
            set.add(1<<i);
        }

        int n = s.length();
        if(n == 0)
            return 0;

        int arr[]=new int[n+1];
        for(int i = 1; i <= n; i++){
            arr[i] = arr[i-1] ^ (1 << (s.charAt(i-1) - 'a'));
        }

        long ret = 0;
        int cnt[] = new int[1<<26];

        for(int i = 0; i <= n; i++){
            for(int j = 0; j < 26; j++){
                int tmp = arr[i] ^ (1 << j);
                ret += cnt[tmp];
            }
            cnt[arr[i]]++;
        }

        return ret;
    }
}
